#!/usr/bin/python
import gnreq
import sys
def main():
	for i in range(1,10):
		op="r-%d-x"%i
		opw="w-%d-x-%d"%(i,i)
		opc="c-%d"%i
		resp = gnreq.main(sys.argv[1],sys.argv[2],"ss2pl",[op])
		if resp.split(" ")[-1] == str(i-1):
			wresp = gnreq.main(sys.argv[1],sys.argv[2],"ss2pl",[opw])
			if wresp.split(" ")[-1] == str(i):
				cresp = gnreq.main(sys.argv[1],sys.argv[2],"ss2pl",[opc])
				if cresp.split(" ")[-1] == "True":
					continue
				else:
					print "Test Failed"
					return
				
			else:
				print "Test failed"

		else:
			print "test failed"
			return
	print "Test passed"
if __name__ == "__main__":
	main()
